package com.xja.controller;

import com.xja.common.JsonBean;
import com.xja.entity.SysRole;
import com.xja.service.SysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author CHENCHEN
 * @company 北京学佳澳教育科技
 * @create 2024-01-15 10:18
 */
@RestController
@RequestMapping("sysRole")
public class SysRoleController {

    @Autowired
    private SysRoleService sysRoleService;

    @GetMapping("getRoleList")
    public JsonBean getRoleList(){

        return sysRoleService.getRoleList();
    }

    @GetMapping("getRoleListByDeptId")
    public JsonBean getRoleListByDeptId(Integer deptId){

        return sysRoleService.getRoleListByDeptId(deptId);
    }

    @GetMapping("selectById")
    public JsonBean selectById(Integer id){

        return sysRoleService.selectById(id);
    }

    @GetMapping("deleteById")
    public JsonBean deleteById(Integer id){

        return sysRoleService.deleteById(id);
    }

    @PostMapping("insertRole")
    public JsonBean insertRole(SysRole sysRole){

        return sysRoleService.insertRole(sysRole);
    }

    @PostMapping("updateRole")
    public JsonBean updateRole(SysRole sysRole){

        return sysRoleService.updateRole(sysRole);
    }

}
